/*
	Header!!!!!


*/

/*
REFERENCE:
	int sys_req  ( int op_code,	    {READ,WRITE,CLEAR,GOTOXY,IDLE,EXIT}
			       int device_id,	{TERMINAL, COM_PORT}
			       char *buf_p,		{the from/to buffer}
			       int *count_p		{length of buffer}
		      );

*/

#include "mpx_supt.h"
#include "trmdrive.h"
#include "commhand.h"
#include "pcbCom.h"
#include "r4code.h"
#include "r5code.h"
#include "r3code.h"
#include "mpxMain.h"



int main(){
	/* Initialize */
	sys_init(MODULE_F); //initialize system, defined in mpx_supt.h
	sys_set_vec(&sys_call);
	init_stack_and_rq(); //defined in r3code.h, initialize stack and ready queue 
	init_io(); //initialize i/o data structures and open devices
	load_init_procs(); //load IDLE process and comhan as a process
	
	/* Run MPX processes */
	//comhan();
	dispatch(); //dispatch comhan
	//printf("The fuck?\n");
	/* Tear Down */
	io_end(); //free memory associated w/ I/O and close devs
	//end_all_processes(); //empty any stragglers and free mem
	sys_exit(); //tear down, defined in mpx_supt.h
	
	return 0;
}


